// @ts-nocheck

import { zoomToheight } from '../format-map-data';

export default {
  async positionClickType({ type = '', coordinatesSystem = 'cgcs2000' } = {}) {
    const self = this;
    self.vickMapRef.setState({
      isMouseMove2d: true,
      isMouseMove3d: false
    });
    if (type == '根据经度、纬度和缩放级别飞行') {
      await self.vickMapPostMessage({
        key: 'cameraFlyTo',
        value: {
          destination: {
            longitude: -100.11316399961062,
            latitude: 31.810327637497902,
            height: zoomToheight(6.297160395610263),
            zoom: 6.297160395610263
          },
          rotation: 0,
          coordinatesSystem: coordinatesSystem
        }
      });
    } else if (type == '根据经度和纬度范围飞行') {
      await self.vickMapPostMessage({
        key: 'cameraFlyTo',
        value: {
          destination: {
            west: -127.16647606171357,
            east: -111.86012228710455,
            north: 43.80055490293921,
            south: 31.668261126628106
          },
          rotation: 0,
          coordinatesSystem: coordinatesSystem
        }
      });
    } else if (type == '自定义飞行时间') {
      await self.vickMapPostMessage({
        key: 'cameraFlyTo',
        value: {
          destination: {
            longitude: -75.9177753980707,
            latitude: 43.058385743288326,
            height: zoomToheight(7.524936272275227),
            zoom: 7.524936272275227
          },
          rotation: 0,
          duration: 3000,
          coordinatesSystem: coordinatesSystem
        }
      });
    } else if (type == '瞬间飞行') {
      await self.vickMapPostMessage({
        key: 'cameraFlyTo',
        value: {
          destination: {
            longitude: -77.64967963539016,
            latitude: 40.77138908316122,
            height: zoomToheight(7.546703975414857),
            zoom: 7.546703975414857
          },
          rotation: 0,
          duration: 0,
          coordinatesSystem: coordinatesSystem
        }
      });
    } else if (type == '飞行到初始位置') {
      await self.vickMapPostMessage({
        key: 'cameraFlyToBegin'
      });
    }
  }
};
